<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<title>K19 Treinamentos</title>
</h:head>
<h:body>

	<h:form>
		<h:panelGrid columns="2">
			<h:outputLabel value="Marca: " for="campo-marca" />
			<h:inputText value="#{carroBean.carro.marca}" id="campo-marca" />

			<h:outputLabel value="Modelo: " for="campo-modelo" />
			<h:inputText value="#{carroBean.carro.modelo}" id="campo-modelo" />

			<h:commandButton value="Cadastrar" action="#{carroBean.adiciona()}" />
		</h:panelGrid>
	</h:form>

	<h:panelGroup rendered="${not empty carroBean.carros}">
		<ul>
			<ui:repeat var="carro" value="#{carroBean.carros}">
				<li><h:outputText value="#{carro.marca} - #{carro.modelo}" /></li>
			</ui:repeat>
		</ul>
	</h:panelGroup>

</h:body>
</html>
